package com.deyuanyun.pic.ctrl.controller;

import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.deyuanyun.pic.common.util.ajax.AjaxSupport;
import com.deyuanyun.pic.common.util.converter.BeanConverter;
import com.deyuanyun.pic.common.util.web.Asserts;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspADcMiorRecordQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspAnodesbedQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspBuriedDepthQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspCipsDcvgQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspCpPowerQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspCptestStationQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspDrainageQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspOcgradeQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspOclpointQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspReferenceQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.ExinspSoilCorrQuery;
import com.deyuanyun.pic.ctrl.controller.dto.exinsp.PipeBaseQuery;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspAcMiorRecordVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspAnodesbedVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspBuriedDepthVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspCipsDcvgVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspCpPowerVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspCptestStationVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspDcMiorRecordVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspDrainageVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspOcgradeVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspOclpointVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspPcmAcvgVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspSaalAnodeVO;
import com.deyuanyun.pic.ctrl.controller.vo.exinsp.ExinspSoilCorrVO;
import com.deyuanyun.pic.ctrl.domain.EqptCppowerr;
import com.deyuanyun.pic.ctrl.domain.EqptCptestStation;
import com.deyuanyun.pic.ctrl.domain.ExinspCpPower;
import com.deyuanyun.pic.ctrl.domain.ExinspSoilCorr;
import com.deyuanyun.pic.ctrl.service.CoatDetectionService;
import com.deyuanyun.pic.ctrl.service.CpTestStationExpandService;
import com.deyuanyun.pic.ctrl.service.CpValidityService;
import com.deyuanyun.pic.ctrl.service.EQPTBaseService;
import com.deyuanyun.pic.ctrl.service.ExinspChartService;
import com.deyuanyun.pic.ctrl.service.StrayCurrentService;
import com.deyuanyun.pic.pipe.controller.BaseController;
import com.github.pagehelper.Page;

/**
 *  外检数据图表Controller
 *  
 *   这个 类 可以完全与ExternalDataMgrController类相同。queryStrayCurrentData方法是自己写的。
 *   
 * @author ChenKui
 * @date 2016-06-16
 */
@Controller
@RequestMapping("/corrctrl/ExinspChart")
public class ExinspChartController extends BaseController{

    
    private @Resource CpValidityService cpValidityService;
    private @Resource StrayCurrentService strayCurrentService;
    private @Resource CoatDetectionService coatDetectionService;
    private @Resource ExinspChartService exinspChartService;
    private @Resource CpTestStationExpandService cpTestStationExpandService;
    private @Resource EQPTBaseService eQPTBaseService;
    
    //进初始化页面
    @RequestMapping("/{path1}/{path2}/init.html")
    public ModelAndView init(@PathVariable("path1") String path1,@PathVariable("path2") String path2,ModelMap model) {
        
        return forword("/corrctrl/external/chart/" + path1 + "/" + path2,model);
    }

    //进初始化页面
    @RequestMapping("/soilCorr/init.html")
    public ModelAndView soilCorr_init(ModelMap model) {
        
        return forword("/corrctrl/external/chart/soilCorr",model);
    }

    
    /**
     * 根据条件 分页查询“阴保有效性”
     *
     * @param type
     *         cptestStation：测试桩检测数据
     *         cpPower：阴保电源检测记录
     *         reference：长效参比电极检测记录
     *         anodesbed：辅助阳极地床检测记录
     *         insedJoint：绝缘装置检测记录
     *         antiSurge：防浪涌保护器检测记录
     *         cpjumper：跨接线检测记录
     *         saalAnode：牺牲阳极检测记录
     *         drainage：排流装置检测记录
     *         cipsDcvg：CIPS+DCVG检测记录
     * @param model 类型对于的阐述对象
     */
    @RequestMapping("/cpValidity/{type}/query.json")
    @ResponseBody
    public void queryCpValidity(@PathVariable("type") String type, HttpServletRequest request) {
        List list = queryCpValidityVO(type, request.getParameterMap());
        for (int i = 0; i < list.size(); i++) {
            Object obj = list.get(i);
            try {//如果有测试桩字段，那么必须要求有值。
                Object ov = PropertyUtils.getProperty(obj, "testStationNum");
                if(ov == null){
                    list.remove(i--);
                    continue;
                }
            }catch (Exception e) {
                //无测试桩，就不判断
            }
            try {//如果有绝对距离字段，那么必须要求有值。
                Object ov = PropertyUtils.getProperty(obj, "mileage");
                if(ov == null){
                    list.remove(i--);
                    continue;
                }
            }catch (Exception e) {
                //无测试桩，就不判断
            }
            if(CpValiDityEnum.ExinspCptestStation.getType().equals(type)){
                //保留1位小数
                ExinspCptestStationVO exinspCptestStationVO = (ExinspCptestStationVO)list.get(i);
                BigDecimal acCurrentDensity = exinspCptestStationVO.getAcCurrentDensity();
                exinspCptestStationVO.setAcCurrentDensity(acCurrentDensity.setScale(1, BigDecimal.ROUND_HALF_UP));
            }
        }
        
        AjaxSupport.sendSuccessText("success", list);
    }


    private <T>List queryCpValidityVO(String type, Map map) {

        if (CpValiDityEnum.ExinspCptestStation.getType().equals(type)) {
            ExinspCptestStationQuery exinspCptestStationQuery = (ExinspCptestStationQuery) BeanConverter.toBean(map, ExinspCptestStationQuery.class);
            return new ExinspCptestStationVO().fromDomainList(cpValidityService.queryExinspCptestStation(exinspCptestStationQuery));
        }
        if (CpValiDityEnum.ExinspCpPower.getType().equals(type)) {
            ExinspCpPowerQuery exinspCpPowerQuery = (ExinspCpPowerQuery) BeanConverter.toBean(map, ExinspCpPowerQuery.class);
            return new ExinspCpPowerVO().fromDomainList(cpValidityService.queryExinspCpPower(exinspCpPowerQuery));
        }/*
        if (CpValiDityEnum.ExinspReference.getType().equals(type)) {
            ExinspReferenceQuery exinspReferenceQuery = (ExinspReferenceQuery) BeanConverter.toBean(map, ExinspReferenceQuery.class);
            return new ExinspReferenceVO().fromDomainList(cpValidityService.queryExinspReference(exinspReferenceQuery));
        }*/
        if (CpValiDityEnum.ExinspAnodesbed.getType().equals(type)) {
            ExinspAnodesbedQuery exinspAnodesbedQuery = (ExinspAnodesbedQuery) BeanConverter.toBean(map, ExinspAnodesbedQuery.class);
            return new ExinspAnodesbedVO().fromDomainList(cpValidityService.queryExinspAnodesbed(exinspAnodesbedQuery));
        }/*
        if (CpValiDityEnum.ExinspInsedJoint.getType().equals(type)) {
            ExinspReferenceQuery exinspReferenceQuery = (ExinspReferenceQuery) BeanConverter.toBean(map, ExinspReferenceQuery.class);
            return new ExinspInsedJointVO().fromDomainList(cpValidityService.queryExinspInsedJoint(exinspReferenceQuery));
        }
        if (CpValiDityEnum.ExinspAntiSurge.getType().equals(type)) {
            ExinspAntiSurgeQuery exinspAntiSurgeQuery = (ExinspAntiSurgeQuery) BeanConverter.toBean(map, ExinspAntiSurgeQuery.class);
            return new ExinspAntiSurgeVO().fromDomainList(cpValidityService.queryExinspAntiSurge(exinspAntiSurgeQuery));
        }
        if (CpValiDityEnum.ExinspCpjumper.getType().equals(type)) {
            ExinspReferenceQuery exinspReferenceQuery = (ExinspReferenceQuery) BeanConverter.toBean(map, ExinspReferenceQuery.class);
            return new ExinspCpjumperVO().fromDomainList(cpValidityService.queryExinspCpjumper(exinspReferenceQuery));
        }*/
        if (CpValiDityEnum.ExinspSaalAnode.getType().equals(type)) {
            ExinspReferenceQuery exinspReferenceQuery = (ExinspReferenceQuery) BeanConverter.toBean(map, ExinspReferenceQuery.class);
            return new ExinspSaalAnodeVO().fromDomainList(cpValidityService.queryExinspSaalAnode(exinspReferenceQuery));
        }
        if (CpValiDityEnum.ExinspDrainage.getType().equals(type)) {
            ExinspDrainageQuery exinspDrainageQuery = (ExinspDrainageQuery) BeanConverter.toBean(map, ExinspDrainageQuery.class);
            return new ExinspDrainageVO().fromDomainList(cpValidityService.queryExinspDrainage(exinspDrainageQuery));
        }
        if (CpValiDityEnum.ExinspCipsDcvg.getType().equals(type)) {
            ExinspCipsDcvgQuery exinspCipsDcvgQuery = (ExinspCipsDcvgQuery) BeanConverter.toBean(map, ExinspCipsDcvgQuery.class);
            return new ExinspCipsDcvgVO().fromDomainList(cpValidityService.queryExinspCipsDcvg(exinspCipsDcvgQuery));
        }
        return null;
    }

    private enum CpValiDityEnum {

        ExinspCptestStation("cptestStation", "测试桩检测数据.xls", "exinsp_cptest_station.xls", 6),
        ExinspCpPower("cpPower", "阴保电源检测记录.xls", "exinsp_cppower.xls", 5),
        //ExinspReference("reference", "长效参比电极检测记录.xls", "exinsp_reference.xls", 6),
        ExinspAnodesbed("anodesbed", "辅助阳极地床检测记录.xls", "exinsp_anodesbed.xls", 4),
        //ExinspInsedJoint("insedJoint", "绝缘装置检测记录.xls", "exinsp_insed_joint.xls", 5),
        //ExinspAntiSurge("antiSurge", "防浪涌保护器检测记录.xls", "exinsp_anti_surge.xls", 4),
        //ExinspCpjumper("cpjumper", "跨接线检测记录.xls", "exinsp_cpjumper.xls", 6),
        ExinspSaalAnode("saalAnode", "牺牲阳极检测记录.xls", "exinsp_saal_anode.xls", 4),
        ExinspDrainage("drainage", "排流装置检测记录.xls", "exinsp_drainage.xlsx", 5),
        ExinspCipsDcvg("cipsDcvg", "CIPS+DCVG检测记录.xls", "exinsp_cips_dcvg.xlsx", 5);

        private String type;
        private String fileName;
        private String tempPath;
        private Integer beginRow;

        private CpValiDityEnum(String type, String fileName, String tempPath, Integer beginRow) {
            this.type = type;
            this.fileName = fileName;
            this.tempPath = tempPath;
            this.beginRow = beginRow;
        }

        public String getType() {
            return type;
        }

        public String getFileName() {
            return fileName;
        }

        public String getTempPath() {
            return tempPath;
        }

        public Integer getBeginRow() {
            return beginRow;
        }

        public static CpValiDityEnum getEnum(String type) {
            CpValiDityEnum[] rs = CpValiDityEnum.values();
            for(int i=0,end=rs.length;i<end;i++) {
                if(rs[i].getType().equals(type)) {
                    return rs[i];
                }
            }
            return null;
        }

    }
    
    
    /*-------阴保有效性已完-----------------*/
    
    
    /**
     * 根据条件 分页查询“土壤腐蚀性评价（土壤电阻率法）”
     *
     * @param exinspSoilCorrQuery
     */
    @RequestMapping(value = "/soilCorr/query.json")
    @ResponseBody
    public void queryExinspSoilCorr(ExinspSoilCorrQuery exinspSoilCorrQuery) {
        Page<ExinspSoilCorr> exinspSoilCorrList = strayCurrentService.queryExinspSoilCorr(exinspSoilCorrQuery);
        AjaxSupport.sendSuccessText("success", new ExinspSoilCorrVO().fromDomainList(exinspSoilCorrList));
    }
    
    /*-------土壤电阻率已完-----------------*/
    

    /**
     * 获取控制电位
     * 
     * @param exinspTaskId 外检任务编号
     * @param testStationId 测试桩编号
     */
    @RequestMapping("/strayCurrent/queryControlPotential.json")
    @ResponseBody
    public void queryControlPotential(@RequestParam("exinspTaskId") String exinspTaskId,@RequestParam("testStationId")String testStationId) {
        
        EqptCppowerr eqptCppowerr = cpTestStationExpandService.queryPower(testStationId);
        ExinspCpPower exinspCpPower = exinspChartService.queryExinspCpPower(exinspTaskId, eqptCppowerr.getId());
        
        AjaxSupport.sendSuccessText("success", exinspCpPower);
    }
    

    /**
     * 根据条件 分页查询“杂散电流”
     *
     * @param type
     *         ac：交流干扰监测记录
     *         dc：直流干扰监测记录
     * @param t 类型对于的阐述对象
     */
    @RequestMapping("/strayCurrent/{type}/query.json")
    @ResponseBody
    public void queryStrayCurrent(@PathVariable("type") String type, ExinspADcMiorRecordQuery t) {
        AjaxSupport.sendSuccessText("success", this.queryStrayCurrentVO(type, t));
    }


    /**
     * 根据条件 分页查询
     *
     * @param type
     *         ac：交流干扰监测记录
     *         dc：直流干扰监测记录
     * @param t 类型对于的阐述对象
     */
    private List queryStrayCurrentVO(String type, ExinspADcMiorRecordQuery t) {
        if (StrayCurrentEnum.ExinspAcMiorRecord.getType().equals(type)) {
            return new ExinspAcMiorRecordVO().fromDomainList(strayCurrentService.queryExinspAcMiorRecord((ExinspADcMiorRecordQuery)t));
        }
        if (StrayCurrentEnum.ExinspDcMiorRecord.getType().equals(type)) {
            return new ExinspDcMiorRecordVO().fromDomainList(strayCurrentService.queryExinspDcMiorRecord((ExinspADcMiorRecordQuery)t));
        }
        return null;
    }

    
    @RequestMapping("/strayCurrent/{type}/queryData.json")
    @ResponseBody
    public void queryStrayCurrentData(@PathVariable("type") String type, @RequestParam("monitorRecordId") String monitorRecordId
            ,HttpServletResponse response) {
        
        byte[] b = null; 
        if(StrayCurrentEnum.ExinspAcMiorRecord.getType().equals(type)){
            b = exinspChartService.queryStrayCurrentDataAC(monitorRecordId);
        }

        else if(StrayCurrentEnum.ExinspDcMiorRecord.getType().equals(type)){
            b = exinspChartService.queryStrayCurrentDataDC(monitorRecordId);
        }
        Asserts.assertTrue(b != null && b.length > 0, "该检测记录无电位数据");
        if(b != null){
            response.setContentType("text/html;charset=utf-8");
            response.setHeader("Content-Encoding", "gzip");
            OutputStream os = null;
            try{
                os = response.getOutputStream();
                os.write(b);
            } catch (IOException e) {
                e.printStackTrace();
            } finally{
                try {
                    os.close();
                } catch (Exception e2) {
                }
            }
        }
        //AjaxSupport.sendSuccessText("success", );
    }

    private enum StrayCurrentEnum {

        ExinspAcMiorRecord("ac", "交流干扰监测记录.xls", "exinsp_ac_mior_record.xlsx", 5),
        ExinspDcMiorRecord("dc","直流干扰监测记录.xls", "exinsp_dc_mior_record.xlsx", 5);

        private String type;
        private String fileName;
        private String tempPath;
        private Integer beginRow;

        private StrayCurrentEnum(String type,String fileName, String tempPath, Integer beginRow) {
            this.type = type;
            this.fileName = fileName;
            this.tempPath = tempPath;
            this.beginRow = beginRow;
        }

        public String getType() {
            return type;
        }

        public String getFileName() {
            return fileName;
        }

        public String getTempPath() {
            return tempPath;
        }

        public Integer getBeginRow() {
            return beginRow;
        }

        public static StrayCurrentEnum getEnum(String type) {
            StrayCurrentEnum[] rs = StrayCurrentEnum.values();
            for(int i=0,end=rs.length;i<end;i++) {
                if(rs[i].getType().equals(type)) {
                    return rs[i];
                }
            }
            return null;
        }
    }

    
    
    /*-------杂散电流干扰已完-----------------*/
    
    
    
    
    /*-------涂层检测与评价开始-----------------*/

    /**
     * 根据条件 分页查询
     *
     * @param type
     *         pcmAcvg：PCM、ACVG测试记录
     *         oclpoint：外涂层漏损点信息
     *         buriedDepth：管道埋深测试记录
     *         ocgrade：外涂层分级评价
     *         pipeCorsTest：管道穿越段测试记录
     *         pipeSpanTest：管道跨越段测试记录
     *         oclpointDig：外涂层漏损点开挖检测记录
     * @param model 类型对于的阐述对象
     * @param <T>
     */
    @RequestMapping("/coatDetection/{type}/query.json")
    @ResponseBody
    public <T>void queryCoatDetection(@PathVariable("type") String type, Model model,HttpServletRequest request) {
        List list = this.queryCoatDetectionVO(type, request.getParameterMap());
        for (int i = 0; i < list.size(); i++) {
            Object obj = list.get(i);
            try {//如果有测试桩字段，那么必须要求有值。
                Object ov = PropertyUtils.getProperty(obj, "testStationNum");
                if(ov == null){
                    list.remove(i--);
                    continue;
                }
            }catch (Exception e) {
                //无测试桩，就不判断
            }
            try {//如果有绝对距离字段，那么必须要求有值。
                Object ov = PropertyUtils.getProperty(obj, "mileage");
                if(ov == null){
                    list.remove(i--);
                    continue;
                }
            }catch (Exception e) {
                //无测试桩，就不判断
            }
            if(CoatDetectionEnum.ExinspBuriedDepth.getType().equals(type)){
                //如果是管道埋深测试，就必须有值。
                ExinspBuriedDepthVO bd = (ExinspBuriedDepthVO)obj;
                if(bd.getBuriedDepth() == null){
                    list.remove(i--);
                    continue;
                }
            }
        }
        if(CoatDetectionEnum.ExinspOcgrade.getType().equals(type)){
            //取起点测试桩的绝对距离、终点测试桩距离
            List<Object[]> list_t = new ArrayList<Object[]>();
            for (int i = 0; i < list.size(); i++) {
                ExinspOcgradeVO exinspOcgradeVO = (ExinspOcgradeVO)list.get(i);
                String beginId = exinspOcgradeVO.getBeginStationId();
                String endId = exinspOcgradeVO.getEndStationId();
                EqptCptestStation testStation1 = eQPTBaseService.queryObjectByPrimaryKey(EqptCptestStation.class, beginId);
                EqptCptestStation testStation2 = eQPTBaseService.queryObjectByPrimaryKey(EqptCptestStation.class, endId);
                //Map<String,Object> map = new HashMap<String, Object>();
                //map.put("", value)
                //testStation1.getMileage();
                //testStation2.getMileage();
                
                Object[] objs1 = new Object[3];
                
                objs1[0] = new BigDecimal(testStation1.getMileage()).movePointLeft(3);
                objs1[1] = new BigDecimal(testStation2.getMileage()).movePointLeft(3);
                objs1[2] = exinspOcgradeVO.getCoatingGrade();
                list_t.add(objs1);
            }
            list = list_t;
        }
        AjaxSupport.sendSuccessText("success", list);
    }
    
    /**
     * 根据条件 分页查询
     *
     * @param type
     *         pcmAcvg：PCM、ACVG测试记录
     *         oclpoint：外涂层漏损点信息
     *         buriedDepth：管道埋深测试记录
     *         ocgrade：外涂层分级评价
     *         pipeCorsTest：管道穿越段测试记录
     *         pipeSpanTest：管道跨越段测试记录
     *         oclpointDig：外涂层漏损点开挖检测记录
     * @param map 类型对于的阐述对象
     * @param <T>
     */
    private <T>List queryCoatDetectionVO(String type, Map map) {
        if (CoatDetectionEnum.ExinspPcmAcvg.getType().equals(type)) {
            PipeBaseQuery baseQuery = (PipeBaseQuery) BeanConverter.toBean(map, PipeBaseQuery.class);
            return new ExinspPcmAcvgVO().fromDomainList(coatDetectionService.queryExinspPcmAcvg(baseQuery));
        }
        if (CoatDetectionEnum.ExinspOclpoint.getType().equals(type)) {
            ExinspOclpointQuery exinspOclpointQuery = (ExinspOclpointQuery) BeanConverter.toBean(map, ExinspOclpointQuery.class);
            return new ExinspOclpointVO().fromDomainList(coatDetectionService.queryExinspOclpoint(exinspOclpointQuery));
        }
        if (CoatDetectionEnum.ExinspBuriedDepth.getType().equals(type)) {
            ExinspBuriedDepthQuery exinspBuriedDepthQuery = (ExinspBuriedDepthQuery) BeanConverter.toBean(map, ExinspBuriedDepthQuery.class);
            return new ExinspBuriedDepthVO().fromDomainList(coatDetectionService.queryExinspBuriedDepth(exinspBuriedDepthQuery));
        }
        if (CoatDetectionEnum.ExinspOcgrade.getType().equals(type)) {
            ExinspOcgradeQuery exinspOcgradeQuery = (ExinspOcgradeQuery) BeanConverter.toBean(map, ExinspOcgradeQuery.class);
            return new ExinspOcgradeVO().fromDomainList(coatDetectionService.queryExinspOcgrade(exinspOcgradeQuery));
        }/*
        if (CoatDetectionEnum.ExinspPipeCorsTest.getType().equals(type)) {
            ExinspPipeCorsTestQuery exinspPipeCorsTestQuery = (ExinspPipeCorsTestQuery) BeanConverter.toBean(map, ExinspPipeCorsTestQuery.class);
            return new ExinspPipeCorsTestVO().fromDomainList(coatDetectionService.queryExinspPipeCorsTest(exinspPipeCorsTestQuery));
        }
        if (CoatDetectionEnum.ExinspPipeSpanTest.getType().equals(type)) {
            ExinspPipeSpanTestQuery exinspPipeSpanTestQuery = (ExinspPipeSpanTestQuery) BeanConverter.toBean(map, ExinspPipeSpanTestQuery.class);
            return new ExinspPipeSpanTestVO().fromDomainList(coatDetectionService.queryExinspPipeSpanTest(exinspPipeSpanTestQuery));
        }
        if (CoatDetectionEnum.ExinspOclpointDig.getType().equals(type)) {
            PipeBaseQuery pipeBaseQuery = (PipeBaseQuery) BeanConverter.toBean(map, PipeBaseQuery.class);
            return new ExinspOclpointDigVO().fromDomainList(coatDetectionService.queryExinspOclpointDig(pipeBaseQuery));
        }*/
        return null;
    }

    private enum CoatDetectionEnum {

        ExinspPcmAcvg("pcmAcvg", "PCM、ACVG测试记录.xls", "exinsp_pcm_acvg.xlsx", 5),
        ExinspOclpoint("oclpoint", "外涂层漏损点信息.xls", "exinsp_oclpoint.xlsx", 5),
        ExinspBuriedDepth("buriedDepth", "管道埋深测试记录.xls", "exinsp_buried_depth.xlsx", 5),
        ExinspOcgrade("ocgrade", "外涂层分级评价.xls", "exinsp_ocgrade.xlsx", 5),
        //ExinspPipeCorsTest("pipeCorsTest", "管道穿越段测试记录.xls", "exinsp_pipe_cors_test.xlsx", 4),
        //ExinspPipeSpanTest("pipeSpanTest", "管道跨越段测试记录.xls", "exinsp_pipe_span_test.xlsx", 4),
        //ExinspOclpointDig("oclpointDig", "外涂层漏损点开挖检测记录.xls", "exinsp_pipe_span_test.xlsx", 4)
        ;

        private String type;
        private String fileName;
        private String tempPath;
        private Integer beginRow;

        private CoatDetectionEnum(String type, String fileName, String tempPath, Integer beginRow) {
            this.type = type;
            this.fileName = fileName;
            this.tempPath = tempPath;
            this.beginRow = beginRow;
        }

        public String getType() {
            return type;
        }

        public String getFileName() {
            return fileName;
        }

        public String getTempPath() {
            return tempPath;
        }

        public Integer getBeginRow() {
            return beginRow;
        }

        public static CoatDetectionEnum getEnum(String type) {
            CoatDetectionEnum[] rs = CoatDetectionEnum.values();
            for(int i=0,end=rs.length;i<end;i++) {
                if(rs[i].getType().equals(type)) {
                    return rs[i];
                }
            }
            return null;
        }

    }

    
}
